//
// Created by work on 24-6-6.
//

#ifndef IOT_PLAT_CRTMODELPARAMETERINFO_H
#define IOT_PLAT_CRTMODELPARAMETERINFO_H

#include <iot_model_device/CRtModelSigBase.h>
#include <os/miscellany/CConfigs.h>

namespace iotplat {

    class CRtModelParameterInfo : public CRtModelSigBase {
    public:
        enum EParameterType {
            EInt,
            EString,
            Efloat
        };

        enum EModelParameterCol {
            EPtype = 0x07,
            EEn_write,
            EEn_read
        };

        EParameterType ptype;
        bool en_write;
        bool en_read;

        static std::map<CRtModelParameterInfo::EModelParameterCol, std::string> rtModelParameterColToStringMap;
        static std::map<CRtModelParameterInfo::EModelParameterCol, CValue::EValueType> rtParameterDataTypeByField;
    public:
        explicit CRtModelParameterInfo();
        void fromJson(Json::Value json);
        Json::Value toJson();
    };

    static const char* t_parameter_name = "t_model_parameter";

#define PARAMETER_ENUM                     CRtModelParameterInfo::EModelParameterCol
#define parameterFieldName(type)           CRtModelParameterInfo::rtModelParameterColToStringMap.find(type)->second
} // iotplat

#endif //IOT_PLAT_CRTMODELPARAMETERINFO_H
